<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="员工姓名" id="i1">
<input type="text" placeholder="员工工资" id="i2">
<input type="text" placeholder="员工工作" id="i3">
<input type="button" value="添加" onclick="f()">
<table border="1">
    <caption>员工列表</caption>
    <tr>
        <th>姓名</th>
        <th>工资</th>
        <th>工作</th>
    </tr>
</table>
<script>
    function f() {
        let tr = document.createElement("tr")
        let nameTD = document.createElement("td")
        let salaryTD = document.createElement("td")
        let jobTD = document.createElement("td")
         //把用户输入的内容赋值给td
        nameTD.innerText = i1.value
        salaryTD.innerText = i2.value
        jobTD.innerText = i3.value
        //把td装进tr
        tr.appendChild(nameTD)
        tr.appendChild(salaryTD)
        tr.appendChild(jobTD)
        //把tr装进table
        let table=document.querySelector("table")
        table.append(tr)

    }
</script>
</body>
</html>